<?php /*a:5:{s:47:"/www/wwwroot/ams/app/admin/view/role/index.html";i:1586527737;s:50:"/www/wwwroot/ams/app/admin/view/public/header.html";i:1588229500;s:48:"/www/wwwroot/ams/app/admin/view/public/side.html";i:1585844348;s:48:"/www/wwwroot/ams/app/admin/view/public/page.html";i:1584353297;s:50:"/www/wwwroot/ams/app/admin/view/public/footer.html";i:1584073532;}*/ ?>
<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>角色管理 | <?php echo htmlentities($system_name); ?></title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="icon" type="image/png" href="/static/admin/i/favicon.png">
    <!-- <link rel="apple-touch-icon-precomposed" href="/static/admin/i/app-icon72x72@2x.png"> -->
    <link rel="stylesheet" href="/static/admin/css/amazeui.min.css" />
    <link rel="stylesheet" href="/static/admin/css/admin.css">
    <link rel="stylesheet" href="/static/admin/css/app.css">
    <!-- <script src="/static/admin/js/echarts.min.js"></script> -->

</head>

<body data-type="index">
    <!-- 头部导航栏 -->
    <header class="am-topbar am-topbar-inverse admin-header">
    <div class="am-topbar-brand">
        <a href="javascript:void(0);" class="tpl-logo">
            <img src="/static/admin/img/logo.png" alt="">
        </a>
    </div>

    <div class="am-icon-list tpl-header-nav-hover-ico am-fl am-margin-right"></div>

    <button class="am-topbar-btn am-topbar-toggle am-btn am-btn-sm am-btn-success am-show-sm-only"
        data-am-collapse="{target: '#topbar-collapse'}"><span class="am-sr-only">导航切换</span> <span
            class="am-icon-bars"></span></button>

    <div class="am-collapse am-topbar-collapse" id="topbar-collapse">

        <ul class="am-nav am-nav-pills am-topbar-nav am-topbar-right admin-header-list tpl-header-list">
            <!-- 提醒 -->
            <!-- <li class="am-dropdown" data-am-dropdown data-am-dropdown-toggle>
                <a class="am-dropdown-toggle tpl-header-list-link" href="javascript:;">
                    <span class="am-icon-bell-o"></span> 提醒 <span
                        class="am-badge tpl-badge-success am-round">5</span></span>
                </a>
                <ul class="am-dropdown-content tpl-dropdown-content">
                    <li class="tpl-dropdown-content-external">
                        <h3>你有 <span class="tpl-color-success">5</span> 条提醒</h3><a href="###">全部</a>
                    </li>
                    <li class="tpl-dropdown-list-bdbc"><a href="#" class="tpl-dropdown-list-fl"><span
                                class="am-icon-btn am-icon-plus tpl-dropdown-ico-btn-size tpl-badge-success"></span>
                            【预览模块】移动端 查看时 手机、电脑框隐藏。</a>
                        <span class="tpl-dropdown-list-fr">3小时前</span>
                    </li>
                    <li class="tpl-dropdown-list-bdbc"><a href="#" class="tpl-dropdown-list-fl"><span
                                class="am-icon-btn am-icon-check tpl-dropdown-ico-btn-size tpl-badge-danger"></span>
                            移动端，导航条下边距处理</a>
                        <span class="tpl-dropdown-list-fr">15分钟前</span>
                    </li>
                    <li class="tpl-dropdown-list-bdbc"><a href="#" class="tpl-dropdown-list-fl"><span
                                class="am-icon-btn am-icon-bell-o tpl-dropdown-ico-btn-size tpl-badge-warning"></span>
                            追加统计代码</a>
                        <span class="tpl-dropdown-list-fr">2天前</span>
                    </li>
                </ul>
            </li> -->
            <!-- 消息 -->
            <!-- <li class="am-dropdown" data-am-dropdown data-am-dropdown-toggle>
                <a class="am-dropdown-toggle tpl-header-list-link" href="javascript:;">
                    <span class="am-icon-comment-o"></span> 消息 <span
                        class="am-badge tpl-badge-danger am-round">9</span></span>
                </a>
                <ul class="am-dropdown-content tpl-dropdown-content">
                    <li class="tpl-dropdown-content-external">
                        <h3>你有 <span class="tpl-color-danger">9</span> 条新消息</h3><a href="###">全部</a>
                    </li>
                    <li>
                        <a href="#" class="tpl-dropdown-content-message">
                            <span class="tpl-dropdown-content-photo">
                                <img src="/static/admin/img/user02.png" alt=""> </span>
                            <span class="tpl-dropdown-content-subject">
                                <span class="tpl-dropdown-content-from"> 禁言小张 </span>
                                <span class="tpl-dropdown-content-time">10分钟前 </span>
                            </span>
                            <span class="tpl-dropdown-content-font"> Amaze UI 的诞生，依托于 GitHub 及其他技术社区上一些优秀的资源；Amaze UI
                                的成长，则离不开用户的支持。 </span>
                        </a>
                        <a href="#" class="tpl-dropdown-content-message">
                            <span class="tpl-dropdown-content-photo">
                                <img src="/static/admin/img/user03.png" alt=""> </span>
                            <span class="tpl-dropdown-content-subject">
                                <span class="tpl-dropdown-content-from"> Steam </span>
                                <span class="tpl-dropdown-content-time">18分钟前</span>
                            </span>
                            <span class="tpl-dropdown-content-font"> 为了能最准确的传达所描述的问题， 建议你在反馈时附上演示，方便我们理解。 </span>
                        </a>
                    </li>

                </ul>
            </li> -->
            <!-- 进度 -->
            <!-- <li class="am-dropdown" data-am-dropdown data-am-dropdown-toggle>
                <a class="am-dropdown-toggle tpl-header-list-link" href="javascript:;">
                    <span class="am-icon-calendar"></span> 进度 <span
                        class="am-badge tpl-badge-primary am-round">4</span></span>
                </a>
                <ul class="am-dropdown-content tpl-dropdown-content">
                    <li class="tpl-dropdown-content-external">
                        <h3>你有 <span class="tpl-color-primary">4</span> 个任务进度</h3><a href="###">全部</a>
                    </li>
                    <li>
                        <a href="javascript:;" class="tpl-dropdown-content-progress">
                            <span class="task">
                                <span class="desc">Amaze UI 用户中心 v1.2 </span>
                                <span class="percent">45%</span>
                            </span>
                            <span class="progress">
                                <div class="am-progress tpl-progress am-progress-striped">
                                    <div class="am-progress-bar am-progress-bar-success" style="width:45%"></div>
                                </div>
                            </span>
                        </a>
                    </li>
                    <li>
                        <a href="javascript:;" class="tpl-dropdown-content-progress">
                            <span class="task">
                                <span class="desc">新闻内容页 </span>
                                <span class="percent">30%</span>
                            </span>
                            <span class="progress">
                                <div class="am-progress tpl-progress am-progress-striped">
                                    <div class="am-progress-bar am-progress-bar-secondary" style="width:30%"></div>
                                </div>
                            </span>
                        </a>
                    </li>
                    <li>
                        <a href="javascript:;" class="tpl-dropdown-content-progress">
                            <span class="task">
                                <span class="desc">管理中心 </span>
                                <span class="percent">60%</span>
                            </span>
                            <span class="progress">
                                <div class="am-progress tpl-progress am-progress-striped">
                                    <div class="am-progress-bar am-progress-bar-warning" style="width:60%"></div>
                                </div>
                            </span>
                        </a>
                    </li>

                </ul>
            </li> -->

            <!-- <li class="am-hide-sm-only">
                <a href="javascript:;" id="admin-fullscreen" class="tpl-header-list-link"><span
                        class="am-icon-arrows-alt"></span>
                    <span class="admin-fullText">开启全屏</span>
                </a>
            </li> -->

            <li class="am-dropdown" data-am-dropdown data-am-dropdown-toggle>
                <a class="am-dropdown-toggle tpl-header-list-link" href="javascript:;">
                    <span class="tpl-header-list-user-nick"></span>
                    <span class="tpl-header-list-user-ico">
                        <!-- <img src="/static/admin/img/user01.png"> -->
                        更多信息
                    </span>
                </a>
                <ul class="am-dropdown-content">
                    <li><a href="<?php echo url('Admin/index'); ?>"><span class="am-icon-bell-o"></span> 资料</a></li>
                    <li><a href="#"><span class="am-icon-cog"></span> 设置</a></li>
                    <li><a href="<?php echo url('login/logOut'); ?>"><span class="am-icon-power-off"></span> 退出</a></li>
                </ul>
            </li>

            <li><a href="<?php echo url('login/logOut'); ?>" class="tpl-header-list-link"><span
                        class="am-icon-sign-out tpl-header-list-ico-out-size"></span></a></li>
        </ul>
    </div>
</header>
<div class="tpl-page-container tpl-page-header-fixed">
    <!-- 左侧侧边栏 -->
    <div class="tpl-left-nav tpl-left-nav-hover">
    <div class="tpl-left-nav-title">
        <?php echo isset($system_name) ? htmlentities($system_name) : ''; ?> 功能列表
    </div>
    <div class="tpl-left-nav-list">
        <ul class="tpl-left-nav-menu">
            <?php if(is_array($classify) || $classify instanceof \think\Collection || $classify instanceof \think\Paginator): $i = 0; $__LIST__ = $classify;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$class): $mod = ($i % 2 );++$i;?>
            <li class="tpl-left-nav-item">
                <a href="<?php echo htmlentities($class['url']); ?>" class="nav-link ">
                    <i class="<?php echo htmlentities($class['icon']); ?>"></i>                    
                    <span><?php echo htmlentities($class['name']); ?></span>
                </a>
            </li>
            <?php endforeach; endif; else: echo "" ;endif; ?>

            <!-- <li class="tpl-left-nav-item">
                <a href="chart.html" class="nav-link active tpl-left-nav-link-list">
                    <i class="am-icon-bar-chart"></i>
                    <span>数据表</span>
                    <i class="tpl-left-nav-content tpl-badge-danger">
                        12
                    </i>
                </a>
            </li>

            <li class="tpl-left-nav-item">
                <a href="javascript:;" class="nav-link tpl-left-nav-link-list">
                    <i class="am-icon-table"></i>
                    <span>表格</span>
                    <i class="am-icon-angle-right tpl-left-nav-more-ico am-fr am-margin-right"></i>
                </a>
                <ul class="tpl-left-nav-sub-menu">
                    <li>
                        <a href="table-font-list.html">
                            <i class="am-icon-angle-right"></i>
                            <span>文字表格</span>
                            <i class="am-icon-star tpl-left-nav-content-ico am-fr am-margin-right"></i>
                        </a>

                        <a href="table-images-list.html">
                            <i class="am-icon-angle-right"></i>
                            <span>图片表格</span>
                            <i class="tpl-left-nav-content tpl-badge-success">
                                18
                            </i>

                            <a href="form-news.html">
                                <i class="am-icon-angle-right"></i>
                                <span>消息列表</span>
                                <i class="tpl-left-nav-content tpl-badge-primary">
                                    5
                                </i>


                                <a href="form-news-list.html">
                                    <i class="am-icon-angle-right"></i>
                                    <span>文字列表</span>

                                </a>
                    </li>
                </ul>
            </li>

            <li class="tpl-left-nav-item">
                <a href="javascript:;" class="nav-link tpl-left-nav-link-list">
                    <i class="am-icon-wpforms"></i>
                    <span>表单</span>
                    <i
                        class="am-icon-angle-right tpl-left-nav-more-ico am-fr am-margin-right tpl-left-nav-more-ico-rotate"></i>
                </a>
                <ul class="tpl-left-nav-sub-menu" style="display: block;">
                    <li>
                        <a href="form-amazeui.html">
                            <i class="am-icon-angle-right"></i>
                            <span>Amaze UI 表单</span>
                            <i class="am-icon-star tpl-left-nav-content-ico am-fr am-margin-right"></i>
                        </a>

                        <a href="form-line.html">
                            <i class="am-icon-angle-right"></i>
                            <span>线条表单</span>
                        </a>
                    </li>
                </ul>
            </li>

            <li class="tpl-left-nav-item">
                <a href="login.html" class="nav-link tpl-left-nav-link-list">
                    <i class="am-icon-key"></i>
                    <span>登录</span>
                </a>
            </li> -->

        </ul>
    </div>
</div>
<div class="tpl-content-wrapper">
    <!-- 中间内容开始 -->

    <!-- 标题 -->
    <div class="tpl-content-page-title">
        <?php echo htmlentities($system_name); ?> -- 角色管理
    </div>
    <!-- 面包屑导航 -->
    <ol class="am-breadcrumb">
        <li><i class="am-icon-home"></i>角色管理</li>
    </ol>
    <!-- 提示信息 -->
    <div class="tpl-content-scope">
        <div class="note note-info">
            <h3> 角色管理
                <span class="close" data-close="note"></span>
            </h3>
            <p>角色管理</p>
            <p><span class="label label-danger">提示:</span>
                前端用户的管理，与后端用户无关
            </p>
        </div>

        <div class="tpl-portlet-components">
            <div class="am-btn-group am-btn-group-xs">
                <button type="button" class="am-btn am-btn-default am-btn-success" onclick="role_add()"><span
                        class="am-icon-plus"></span>
                    新增角色</button>
            </div>

            <table class="am-table am-table-striped am-table-hover table-main">
                <thead>
                    <tr>
                        <th class="table-id">#</th>
                        <th class="table-title">角色名称</th>
                        <th class="table-author">角色状态</th>
                        <th class="table-type">创建者</th>
                        <th style="width: 200px;">备注</th>
                        <th class="table-date">创建时间</th>
                        <th class="table-set" style="width: 220px;">操作</th>
                    </tr>
                </thead>
                <tbody>
                    <?php if(is_array($role_list) || $role_list instanceof \think\Collection || $role_list instanceof \think\Paginator): $i = 0; $__LIST__ = $role_list;if( count($__LIST__)==0 ) : echo "$empty" ;else: foreach($__LIST__ as $key=>$row): $mod = ($i % 2 );++$i;?>
                    <tr>
                        <td><?php echo htmlentities($row['id']); ?></td>
                        <td><?php echo htmlentities($row['name']); ?></td>
                        <td>
                            <?php if($row['status'] == 1): ?>
                            <span style="color: green;"><?php echo htmlentities(par_role_status($row['status'])); ?></span>
                            <?php else: ?>
                            <span style="color: red;"><?php echo htmlentities(par_role_status($row['status'])); ?></span>
                            <?php endif; ?>
                        </td>
                        <td><?php echo htmlentities($row['admin_name']); ?></td>
                        <td><?php echo htmlentities($row['note']); ?></td>
                        <td><?php echo htmlentities(date('Y-m-d H:i',!is_numeric($row['create_time'])? strtotime($row['create_time']) : $row['create_time'])); ?></td>
                        <td>
                            <div class="am-btn-toolbar">
                                <div class="am-btn-group am-btn-group-xs">
                                    <button class="am-btn am-btn-default am-btn-xs am-text-secondary am-hide-sm-only"
                                        onclick="role_permissions('<?php echo htmlentities($row['id']); ?>')"><span class="am-icon-pencil-square-o"></span>
                                        授权</button>
                                    <button class="am-btn am-btn-default am-btn-xs am-text-secondary"
                                        onclick="role_edit('<?php echo htmlentities($row['id']); ?>')"><span class="am-icon-pencil-square-o"></span>
                                        编辑</button>
                                    <button class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only"
                                        onclick="role_del('<?php echo htmlentities($row['id']); ?>')"><span class="am-icon-trash-o"></span>
                                        删除</button>
                                </div>
                            </div>
                        </td>
                    </tr>
                    <?php endforeach; endif; else: echo "$empty" ;endif; ?>
                </tbody>
            </table>
            <!-- 加载分页组件 -->
            <?php if($page_res['len']): ?>
<div class="am-cf">
    <div class="am-fr">
        <ul class="am-pagination tpl-pagination">
            <li>
                <a href="<?php echo htmlentities($page_res['url']); ?>?p=0">«</a>
            </li>
            <?php if(is_array($page_res['len']) || $page_res['len'] instanceof \think\Collection || $page_res['len'] instanceof \think\Paginator): $i = 0; $__LIST__ = $page_res['len'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$row): $mod = ($i % 2 );++$i;?>
                <li class="<?php echo $page_res['p']==$row+1 ? 'am-active'  :  ''; ?>"><a href="<?php echo htmlentities($page_res['url']); ?>?p=<?php echo htmlentities($row); ?>"><?php echo htmlentities($row+1); ?></a></li>
            <?php endforeach; endif; else: echo "" ;endif; ?>
            <li><a href="<?php echo htmlentities($page_res['url']); ?>?p=<?php echo htmlentities($row); ?>">»</a></li>
        </ul>
    </div>
</div>
<?php endif; ?>

        </div>
    </div>


    <!-- 中间内容结束 -->
    <!-- 底部 -->
    <!-- <style>
    .footer {
        position: absolute;
        bottom: 0;
        height: 80px;
        line-height: 80px;
        text-align: center;
        background-color: #ffffff;
        width: 100%;
    }
</style>
    </div>
</div>

<div class="footer">
    
    底部

</div>
 -->

    <script src="/static/admin/lib/jquery/jquery.js"></script>
    <script src="/static/admin/js/amazeui.min.js"></script>
    <script src="/static/admin/js/app.js"></script>
    <script src="/static/admin/lib/layer/layer.js"></script>
    <script>

        // 添加角色
        function role_add() {
            return layer.open({
                type: 2,
                title: '添加一个角色',
                skin: 'layui-layer-rim', //加上边框
                area: ['420px', '380px'], //宽高
                content: "<?php echo url('Role/role_add'); ?>",
                end: function (e) {
                    location.reload();
                }
            });
        }

        // 角色详情
        function role_edit($rid) {
            redirect_url("<?php echo url('Role/role_edit'); ?>?rid=" + $rid);
        }

        // 删除角色
        function role_del($rid) {
            layer.prompt({ title: '如果要删除角色，请输入[立即删除]', formType: 0 }, function (text, index) {
                layer.close(index);
                if (text != "立即删除") {
                    return layer.msg('口令输入错误，立即删除', { icon: 2, time: 1500 });
                }
                $.ajax({
                    url: "<?php echo url('Role/role_del'); ?>",
                    data: {
                        'rid': $rid
                    },
                    type: "POST",
                    dataType: "JSON",
                    success: function (res) {
                        // 返回结果处理
                        if (res.code == 0) {
                            return layer.msg(res.msg, { icon: 1, time: 900 }, function () {
                                location.reload();
                            });
                        } else {
                            return layer.msg(res.msg, { icon: 2, time: 900 });
                        }
                    }
                });
            });

        }

        // 授权
        function role_permissions($rid){
            redirect_url("<?php echo url('Role/role_permissions'); ?>?rid=" + $rid);
        }

        // 返回按钮
        function back() {
            // 获取到父级容器
            var index = parent.layer.getFrameIndex(window.name);
            // 关闭父级容器
            parent.layer.close(index);
        }

        // 重定向
        function redirect_url(url) {
            window.location.href = url;
        }

    </script>
</body>

</html>